package com.example.movie.data.movie.model

import com.example.movie.common.model.BaseResponse
import com.example.movie.common.model.Result
import com.example.movie.data.movie.model.bean.ApproveBean
import com.example.movie.data.movie.model.vo.*

class MovieRepository(val dataSource: MovieDataSource) {

    fun getMovieDetailData(movieId: Int): Result<MovieDetailVo>? {
        return dataSource.getMovieDetailData(movieId)
    }

    fun getMovieData(): Result<MovieListVo> {
        return dataSource.loadIndexData()
    }

    fun search(key: String): Result<List<SearchVo>>? {
        return dataSource.search(key)
    }

    fun chanUserAndMovieState(movieId: Int, type: Int): Result<Boolean>? {
        return dataSource.changeUserAndMovieState(movieId,type)
    }

    fun addForum(movieId: Int, forum: String, pid: Int?, toId: String?): Result<Int>? {
        return dataSource.addForum(movieId,forum,pid,toId)
    }

    fun approve(forumId: Int): Result<ApproveBean>? {
        return dataSource.approve(forumId)
    }

    fun loadForumPage(movieId: Int, page: Int?, size: Int?): Result<BaseResponse<List<ForumVo>>>? {
        return dataSource.loadForumPage(movieId,page,size)
    }

    fun loadReplies(pid: Long, page: Int, size: Int): Result<BaseResponse<List<ForumVo>>>? {
        return dataSource.loadReplies(pid,page,size)
    }

    fun loadMovieTopList(): Result<List<MovieVo>>? {
        return dataSource.loadMovieTopList()
    }

}